package com.ptswitch.material.pages.hlog;

import org.apache.tapestry5.EventConstants;
import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.OnEvent;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.ptswitch.material.pages.base.MaterialBasePage;
import com.ptswitch.material.service.HLogService;
import com.ptswitch.material.util.HlogConstants;

public class ClearHLog extends MaterialBasePage {
    @Inject
    private HLogService hlogSer;
    @InjectPage
    private ListHLog listHLog;

    @OnEvent(value = EventConstants.ACTIVATE)
    public Object clear() {
        checkUserIsAdmin();
        hlogSer.deleteAll();
        hlog(HlogConstants.deleteAllHLog);
        return listHLog.initialize();
    }

}
